<?php include $this->getViewFile('/common/Head') ?>
<body class="J_scroll_fixed">
<style>
.col-left{float:left}
.col-auto{overflow:hidden;_zoom:1;_float:left;}
.title-1{border-bottom:1px solid #eee; padding-left:5px}
.f14{font-size: 14px}
.lh28{line-height: 28px}
.blue,.blue a{color:#004499}
.gray4,a.gray4{color:#999;}
.lh22{line-height: 22px}
.lh25{line-height: 25px}
</style>
<div class="wrap J_check_wrap">
  <?php include $this->getViewFile('/common/Nav') ?>
  <div class="table_list">
    <table width="100%" cellspacing="0">
      <thead>
        <tr>
          <td width="50" align="center">ID</td>
          <td>广告信息</td>
          <td width="100" align="center">平台</td>
          <td width="100" align="center">显示位置</td>
          <td align="center" width="100">操作</td>
        </tr>
      </thead>
      <tbody>
        <?php
		  foreach ($data as $picInfo){
		  ?>
        <tr>
          <td align="center"><?php echo$picInfo['aid'] ?></td>
          <td><div class="col-left mr10" style="width:300px; height:112px"><img src="<?php echo $picInfo['filepath'];?>" width="300" height="112" style="border:1px solid #eee" align="left"></div>
            <div class="col-auto">
              <h2 class="title-1 f14 lh28 mb6 blue"><?php echo $picInfo['title'];?></h2>
              <p class="gray4 lh25"> 图片地址：<?php echo $picInfo['filepath'];?><br/>
                链接地址：<?php echo $picInfo['url'];?> </p>
            </div></td>
          <td align="center"><?php if($picInfo['platform']==0){ echo Andriod;}elseif($picInfo['platform']==1){ echo ios;}elseif($picInfo['platform']==2){ echo Andriod;}else{echo ios;} ?></td>
          <td align="center"><?php if($picInfo['platform']==0){ echo 启动图;}elseif($picInfo['platform']==1){ echo 启动图;}elseif($picInfo['platform']==2){ echo 广告图;}else{echo 广告图;} ?></td>
          <td align="center"><a href="javascript:preview(<?php echo  $picInfo['aid']?>, '<?php echo $picInfo['filepath']?>','<?php echo $picInfo['filepath']?>')">预览</a> | <a  href="<?php echo AdminBase::U('editpic', array('pid' => $picInfo['pid'])) ?>">修改</a> | <a class="J_ajax_del" data-msg="确定要删除该图片吗？" href="<?php echo AdminBase::U('delete', array('aid' => $picInfo['aid'])) ?>">删除</a></td>
        </tr>
        <?php
		  }
		  ?>
      </tbody>
    </table>
    <div class="p10">
      <div class="pages"><?php echo $Page;?></div>
    </div>
  </div>
</div>
<script src="<?php echo $staticUrl; ?>statics/js/common.js"></script> 
<script src="<?php echo $staticUrl; ?>statics/js/content_addtop.js"></script> 
<script type="text/javascript">
//附件预览
function preview(id, name, filepath) {
    if (IsImg(filepath)) {
        Wind.use('artDialog', 'imgready', function () {
            imgReady(filepath, function () {
                var width = 0,
                    maxWidth = 500,
                    maxHeight = 500,
                    height = 0;
                var hRatio;
                var wRatio;
                var Ratio = 1;
                var w = this.height;
                var h = this.width;
                wRatio = 500 / this.height;
                hRatio = 500 / this.width;

                if (maxWidth == 0) { //
                    if (hRatio < 1) Ratio = hRatio;
                } else if (maxHeight == 0) {
                    if (wRatio < 1) Ratio = wRatio;
                } else if (wRatio < 1 || hRatio < 1) {
                    Ratio = (wRatio <= hRatio ? wRatio : hRatio);
                }
                if (Ratio < 1) {
                    w = w * Ratio;
                    h = h * Ratio;
                }
                width = h;
                height = w;

                art.dialog({
                    title: '预览',
                    fixed: true,
                    width: width,
                    height: height,
                    id: "image_priview",
                    lock: true,
                    background: "#CCCCCC",
                    opacity: 0,
                    content: '<img src="' + filepath + '"  width="' + width + '" height="' + height + '" />'
                });

            });
        });
    } else {
        Wind.use('artDialog', function () {
            art.dialog({
                title: '预览',
                padding: 0,
                width: 230,
                height: 150,
                content: '<a href="' + filepath + '" target="_blank"><img src="<?php echo $staticUrl; ?>statics/images/icon/down.gif">单击打开</a>',
                lock: true
            });
        });
    }
}
</script>
</body>
</html>